<template>
	<view>
		<view class="header">
			<view class="iconfont icon-zuo icon" @tap="$common.go1('/pages/myhouse/myhouse')">返回</view>
			<view class="houses">房屋认证</view>
		</view>
		<view class="xinxi">房屋信息</view>
		<view class="content">
			<view class="center">
				<view class="xiaoqu">
				<view class="xiaoquSon">小区</view>
					<picker @change="bindPickerChange" :value="index" :range="buildingData" range-key="name">
						<view class="pick">
							<view class="xiaoquSons">{{index===''?'请选择小区':buildingData[index].name}}</view>
							<text class="iconfont icon-right-1-copy icon"></text>
						</view>
					</picker>
				</view>
				<view class="room">
					<view class="roomSon">楼栋房号</view>
					<view class="roomSons" @tap="$common.go('/pages/houseSon/houseSon')">请选择楼栋信息</view>
					<text class="iconfont icon-right-1-copy icon"></text>
				</view>
				<view class="resident">
					<view class="residentSon">住户类型</view>
					<picker @change="bindUserTypePickerChange" :value="indextype" :range="userinfotypeData" range-key="name">
						<view class="pick">
							<view class="residentSons">{{indextype===''?'请选择住户类型':userinfotypeData[indextype].name}}</view>
							<text class="iconfont icon-right-1-copy icon"></text>
						</view>
					</picker>
				</view>
			</view>
		</view>
		<view class="xinxi">个人信息</view>
		<view class="centers">
			<view class="names">
				<view class="namesSon">姓名</view>
				<input type="text" placeholder="请填写姓名" />
			</view>
			<view class="tel">
				<view class="telSon">联系电话</view>
				<input type="text" placeholder="13522568755" />
			</view>
		</view>
		<view class="submit" @tap="$common.go('/pages/fangwuren/fangwuren')">提交</view>
		<view class="box"></view>
	</view>
</template>

<script>
	import Api from '@/api/index.js'
	export default {
		data() {
			return {
				index: '',
				buildingData : [],
				indextype : '',
				userinfotypeData : []
			};
		},
		onLoad(){
			this.getBuildingList()
			this.getUserinfotypeList()
		},
		methods: {
			async getBuildingList(){
				let res = await Api.buildingList()
				this.buildingData = res.data.list
				// console.log(res);
			},
			async getUserinfotypeList(){
				let res = await Api.userinfotypeList()
				this.userinfotypeData = res.data.list
				console.log(res);
			},
			bindUserTypePickerChange: function(e){
				// console.log('picker发送选择改变，携带值为', e.detail.value)
				this.indextype = e.detail.value
			},
			bindPickerChange: function(e) {
				// console.log('picker发送选择改变，携带值为', e.detail.value)
				this.index = e.detail.value
			},
		}
	}
</script>

<style lang="less">
	@import url('house.less');
</style>